package ee.filter;

import ee.db.UserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.servlet.*;
import java.io.IOException;

@Component
public class LoginFilter implements Filter{
  private Logger logger = LoggerFactory.getLogger(LoginFilter.class);
  @Autowired
  private UserService userService;

  public void init(FilterConfig filterConfig) throws ServletException {
    logger.info("Initialized");
  }

  public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
    logger.info("Checking request validity");
    filterChain.doFilter(servletRequest, servletResponse);
  }

  public void destroy() {
    logger.info("destroyed");
  }
}
